<template>
	<div class="aaa">
		<div class="diany" v-for="jia in jijiang">
			<div class="tu">
				
				<img :src="jia.cover.origin" />
			</div>
			<div class="jiaqia">
				<div class="jaleft ">
					<p v-text="jia.name">银河护卫队</p>
				</div>
				<div class="jafen jafen2">{{jia.premiereAt | formatDate}}</div>
			</div>
		</div>
		<div class="gengduo">
			<a href="#">即将上映电影</a>
		</div>
		<!--返回顶部-->
		<div class="iconfont icon-fanhuidingbu dingbu">
		</div>
		
	</div>

</template>

<script>
	import $ from 'jquery'

	//滚动到一定距离显示返回顶部箭头
	$(function() {
		$(window).bind("scroll", function() {

			if($(document).scrollTop() > $(".banner").height()) {
				$(".dingbu").css('display', 'block')
			} else {
				$(".dingbu").hide()
			}
		});
	});
	//点击返回顶部
	$(function() {
		$(".dingbu").on("click", function() {
			console.log(111)
			$('body,html').animate({
				scrollTop: 0
			}, 500);
			return false;
		});
	});
	
	//
	export default {
		data: function() {
			return {
				jijiang: []
			}
		},
		filters: {
            'formatDate': function(val) {
                var time = new Date(val);
                var m = time.getMonth() + 1;
                var d = time.getDate();
                return m + '月' + d + '日上映';
            }
       },
		mounted: function() {
			var url = 'http://localhost:3000/jijiang?time=' + new Date().getTime();
			var chat = this;
			$.get(url, function(res) {
				console.log(res)
				chat.jijiang = res.data.films
			})
		}
	}
</script>

<style>

</style>